home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap09 / Paint6 / Paint6.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.3 KB  |  57 lines

  1. //***********************************************************************
  2. //
  3. //  Paint6.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include <afxext.h>
  9. #include "Resource.h"
  10. #include "CLine.h"
  11. #include "Paint6.h"
  12. #include "Splitter.h"
  13. #include "MainFrame.h"
  14. #include "Paint6Doc.h"
  15. #include "Paint6View.h"
  16. #include "AboutDlg.h"
  17.  
  18. CPaintApp myApp;
  19.  
  20. BEGIN_MESSAGE_MAP (CPaintApp, CWinApp)
  21.     ON_COMMAND (ID_FILE_NEW, CWinApp::OnFileNew)
  22.     ON_COMMAND (ID_FILE_OPEN, CWinApp::OnFileOpen)
  23.     ON_COMMAND (ID_APP_ABOUT, OnAppAbout)
  24. END_MESSAGE_MAP ()
  25.  
  26. BOOL CPaintApp::InitInstance ()
  27. {
  28.     SetRegistryKey ("Programming Windows 95 with MFC");
  29.     LoadStdProfileSettings ();
  30.  
  31.     CSingleDocTemplate* pDocTemplate;
  32.     pDocTemplate = new CSingleDocTemplate (
  33.         IDR_MAINFRAME,
  34.         RUNTIME_CLASS (CPaintDoc),
  35.         RUNTIME_CLASS (CMainFrame),
  36.         RUNTIME_CLASS (CPaintView)
  37.     );
  38.  
  39.     AddDocTemplate (pDocTemplate);
  40.     RegisterShellFileTypes (TRUE);
  41.  
  42.     CCommandLineInfo cmdInfo;
  43.     ParseCommandLine (cmdInfo);
  44.  
  45.     if (!ProcessShellCommand (cmdInfo))
  46.         return FALSE;
  47.  
  48.     m_pMainWnd->DragAcceptFiles ();
  49.     return TRUE;
  50. }
  51.  
  52. void CPaintApp::OnAppAbout ()
  53. {
  54.     CAboutDialog dlg;
  55.     dlg.DoModal ();
  56. }
  57.